<script setup>
import { ref } from 'vue'
import axios from 'axios'

const username = ref('')
const password = ref('')

const login = async () => {
  const res = await axios.post('/api/auth/login', {
    username: username.value,
    password: password.value
  })
  alert(res.data.message)
}
</script>

<template>
  <el-form @submit.prevent="login">
    <el-form-item label="用户名">
      <el-input v-model="username" />
    </el-form-item>
    <el-form-item label="密码">
      <el-input type="password" v-model="password" />
    </el-form-item>
    <el-button type="primary" @click="login" block>登录</el-button>
  </el-form>
</template>